A known image forming apparatus includes a bet unit and a developer density sensor for detecting a density of a developer transferred onto a belt. In the image forming apparatus, the developer density sensor is also used for determining whether the belt unit is attached to a main body.
The determination whether the belt unit is attached to the main body is made by a light receiving element when the light receiving element receives light emitted from a light emitting element and reflected from the belt.